.class Lcom/hyphenate/chat/EMCallManager$2;
.super Ljava/lang/Object;

# interfaces
.implements Lcom/hyphenate/chat/EMCallManager$EMCallPushProvider;


# instance fields
.field final synthetic this$0:Lcom/hyphenate/chat/EMCallManager;


# direct methods
.method constructor <init>(Lcom/hyphenate/chat/EMCallManager;)V
    .locals 0

    iput-object p1, p0, Lcom/hyphenate/chat/EMCallManager$2;->this$0:Lcom/hyphenate/chat/EMCallManager;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public onRemoteOffline(Ljava/lang/String;)V
    .locals 4

    const-string/jumbo v0, "EMCallManager"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v2, "onRemoteOffline, to:"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/hyphenate/util/EMLog;->d(Ljava/lang/String;Ljava/lang/String;)V

    const-string/jumbo v0, "You have an incoming call"

    invoke-static {v0, p1}, Lcom/hyphenate/chat/EMMessage;->createTxtSendMessage(Ljava/lang/String;Ljava/lang/String;)Lcom/hyphenate/chat/EMMessage;

    move-result-object v1

    new-instance v2, Lorg/json/JSONObject;

    invoke-direct {v2}, Lorg/json/JSONObject;-><init>()V

    :try_start_0
    const-string/jumbo v0, "em_push_title"

    const-string/jumbo v3, "You have an incoming call"

    invoke-virtual {v2, v0, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    const-string/jumbo v0, "em_apns_ext"

    invoke-virtual {v1, v0, v2}, Lcom/hyphenate/chat/EMMessage;->setAttribute(Ljava/lang/String;Lorg/json/JSONObject;)V

    const-string/jumbo v2, "is_voice_call"

    iget-object v0, p0, Lcom/hyphenate/chat/EMCallManager$2;->this$0:Lcom/hyphenate/chat/EMCallManager;

    iget-boolean v0, v0, Lcom/hyphenate/chat/EMCallManager;->isVideoCall:Z

    if-nez v0, :cond_0

    const/4 v0, 0x1

    :goto_1
    invoke-virtual {v1, v2, v0}, Lcom/hyphenate/chat/EMMessage;->setAttribute(Ljava/lang/String;Z)V

    new-instance v0, Lcom/hyphenate/chat/EMCallManager$2$1;

    invoke-direct {v0, p0, v1, p1}, Lcom/hyphenate/chat/EMCallManager$2$1;-><init>(Lcom/hyphenate/chat/EMCallManager$2;Lcom/hyphenate/chat/EMMessage;Ljava/lang/String;)V

    invoke-virtual {v1, v0}, Lcom/hyphenate/chat/EMMessage;->setMessageStatusCallback(Lcom/hyphenate/EMCallBack;)V

    invoke-static {}, Lcom/hyphenate/chat/EMClient;->getInstance()Lcom/hyphenate/chat/EMClient;

    move-result-object v0

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMClient;->chatManager()Lcom/hyphenate/chat/EMChatManager;

    move-result-object v0

    invoke-virtual {v0, v1}, Lcom/hyphenate/chat/EMChatManager;->sendMessage(Lcom/hyphenate/chat/EMMessage;)V

    return-void

    :catch_0
    move-exception v0

    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_0

    :cond_0
    const/4 v0, 0x0

    goto :goto_1
.end method

.method updateMessageText(Lcom/hyphenate/chat/EMMessage;Ljava/lang/String;)V
    .locals 2

    invoke-static {}, Lcom/hyphenate/chat/EMClient;->getInstance()Lcom/hyphenate/chat/EMClient;

    move-result-object v0

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMClient;->chatManager()Lcom/hyphenate/chat/EMChatManager;

    move-result-object v0

    invoke-virtual {p1}, Lcom/hyphenate/chat/EMMessage;->getTo()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/hyphenate/chat/EMChatManager;->getConversation(Ljava/lang/String;)Lcom/hyphenate/chat/EMConversation;

    move-result-object v0

    if-eqz v0, :cond_0

    invoke-virtual {p1}, Lcom/hyphenate/chat/EMMessage;->getMsgId()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/hyphenate/chat/EMConversation;->removeMessage(Ljava/lang/String;)V

    :cond_0
    return-void
.end method
